<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<script src="/js/jquery.min.js?v=2.1.4"></script>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<input id="workId" name="workId" type="hidden">

							<div class="form-group">
								<label class="col-sm-3 control-label">人员姓名：</label>
								<div class="col-sm-8">
									<input type="hidden" id="userId" name="userId" th:value="${userInfoDTO.userId}" >
									<input id="username" disabled th:value="${userInfoDTO.username}"  name="username" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">工作是否有两年：</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="workTime" value="1" /> 是
									</label>
									<label class="radio-inline">
										<input type="radio" name="workTime" value="0" /> 否
									</label>
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">全称：</label>
								<div class="col-sm-8">
									<input id="workAllName" name="workAllName" placeholder="请输入长度不大于120的字符" maxlength="120" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">简称：</label>
								<div class="col-sm-8">
									<input id="workSimpleName" name="workSimpleName" placeholder="请输入长度不大于60的字符" maxlength="60" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">任职机构：</label>
								<div class="col-sm-8">
									<input id="workInstitution" name="workInstitution" placeholder="请输入长度不大于45的字符" maxlength="45" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">任职名称：</label>
								<div class="col-sm-8">
									<input id="workName" name="workName" placeholder="请输入长度不大于45的字符" maxlength="45" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">职务名称：</label>
								<div class="col-sm-8">
									<input id="officeName" name="officeName" placeholder="请输入长度不大于45的字符" maxlength="45" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">成员类别：</label>
								<div class="col-sm-8">
									<input id="workCategory" name="workCategory" placeholder="请输入长度不大于45的字符" maxlength="45" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">选拔任用方式：</label>
								<div class="col-sm-8">
									<input id="selectMethods" name="selectMethods" placeholder="请输入长度不大于45的字符" maxlength="45" class="form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">任职时间：</label>
								<div class="col-sm-8">
									<input id="workingTime" name="workingTime" placeholder="请选择任职时间" readonly class="layer-date form-control" type="text">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">离职时间：</label>
								<div class="col-sm-8">
									<input id="leavingTime" name="leavingTime" placeholder="请选择离职时间" readonly class="layer-date form-control" type="text">
									<input type="hidden" id="createTime" name="createTime">
								</div>
							</div>


							<div class="form-group">
								<label class="col-sm-3 control-label">任职文号（图片）：</label>
								<div class="col-sm-8">
									<input type="hidden" id="documentFileId" name="documentFileId" >
									<img id="showImg" src="/img/backg01.jpg" style="width: 80%;cursor: pointer;" >
									<input  type="file" class="hidden" id="file" name="file" onchange="uploadFile(this.files)" />
								</div>

								<script type="text/javascript">
                                    $("#showImg").click(function () {
                                        $("#file").click();
                                    });

                                    function uploadFile(files) {
                                        var type = files[0].type;
                                        if(type.indexOf("image") < 0){
                                            layer.msg('请上传图片格式...', {
                                                icon: 2
                                            });
                                            return false;
                                        }
                                        var size = files[0].size;
                                        if ((size / 1024 / 1024) > 2) {
                                            layer.msg('图片大小不能超过2M...', {
                                                icon: 2
                                            });
                                            return false;
                                        }
                                        console.log("size=" + size);
                                        var formData = new FormData();
                                        formData.append("file", files[0]);
                                        $.ajax({
                                            data: formData,
                                            type: "POST",
                                            url: "/common/sysFile/upload",    // 图片上传出来的url，返回的是图片上传后的路径，http格式
                                            cache: false,
                                            contentType: false,
                                            processData: false,
                                            dataType: "json",
                                            success: function (data) {//data是返回的hash,key之类的值，key是定义的文件名
                                                $("#showImg").attr("src", data.fileName);
                                                $("#documentFileId").val(data.sysFileId);
                                            },
                                            error: function () {
                                                layer.msg('上传失败', {
                                                    icon: 2
                                                });
                                            }
                                        });
                                    }
								</script>
							</div>


							<div class="form-group">
								<label class="col-sm-3 control-label">状态：</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="status" value="1" />正常
									</label>
									<label class="radio-inline">
										<input type="radio" name="status" value="0" />禁用
									</label>
								</div>
							</div>

							<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
								</div>
							</div>
						</form>
					</div>
					<div class="ibox-content">
						<table id="exampleTable2" data-mobile-responsive="true">
						</table>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript" src="/js/appjs/phry/workHistory/edit.js">
	</script>

	<script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#workingTime',
                type: 'date',
                range: false,
                format: 'yyyy-M-d'
            });
        })
	</script>

	<script>
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#leavingTime',
                type: 'date',
                range: false,
                format: 'yyyy-M-d'
            });
        })
	</script>
</body>
</html>
